﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;

namespace Microsoft.Rtc.Collaboration.Samples.HTMLPresenceControls.Service.Common
{
    public class PresenceSubscription
    {
        public static string NoChange = "No change";
        public static long NoChangeInAvailability = -1;

        public string SipUri { get; set; }
        public string ContactName { get; set; }
        public long Availability { get; set; }
        public string Status { get; set; }
        public DateTime SubscriptionCreated { get; set; }

        public override bool Equals(object obj)
        {
            var compareObj = obj as PresenceSubscription;
            if (compareObj == null)
            {
                return false;
            }
            else
            {
                return compareObj.SipUri == this.SipUri;
            }
        }

        public override int GetHashCode()
        {
            return SipUri.GetHashCode();
        }

        
        public override string ToString()
        {
            return
                string.Format("PresenceSubscription => [ SipUri = {0}, ContactName = {1}, Availability = {2}, Status = {3}, SubscriptionCreated = {4} ]",
                    SipUri, ContactName, Availability, Status, SubscriptionCreated);
        }
        
    }
}